﻿using FactoryLib.abstracts;
using FactoryLib.services.Heros;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FactoryLib.services.SimpleFactory
{
    /// <summary>
    /// 简单工厂：相对简单，对象的创建全都集中在这个工厂中
    /// </summary>
    public class SimpleHeroFactory : IHeroFactory
    {
        public Ihero CreatHero(string heroName)
        {
            switch (heroName)
            {
                case "sun": return new HeroSunWukong();
                case "ali": return new HeroAli();
                case "luban": return new HeroLuBan();
                case "make":return new HeroMarkBoluo();
                default:
                    return new HeroSunWukong();
            }
        }
    }
}
